<?php

class DBMObjectTranslator implements DBMTranslator {
	
	public static function translateToMySQL($obj, $command = null) {
		if(in_array("DBMDatabaseObject", class_implements($obj))){
			return DBMGeneralTranslator::translateToMySQL($obj->getIdentity(), $command);
		} else {
			return DBMGeneralTranslator::translateToMySQL($obj->__toString(), $command);
		}
	}
	
	public static function translateToPostgreSQL($obj, $command = null) {
		if(in_array("DBMDatabaseObject", class_implements($obj))){
			return DBMGeneralTranslator::translateToPostgreSQL($obj->getIdentity());
		} else {
			return DBMGeneralTranslator::translateToPostgreSQL($obj->__toString());
		}
	}
	
	public static function translateToSQLServer($obj, $command = null) {
		if(in_array("DBMDatabaseObject", class_implements($obj))){
			return DBMGeneralTranslator::translateToSQLServer($obj->getIdentity(), $command);
		} else {
			return DBMGeneralTranslator::translateToSQLServer($obj->__toString(), $command);
		}
	}
}

?>
